package edu.biwu.sms;

import edu.biwu.sms.Annotation.Validate;
import edu.biwu.sms.enum01.EnrollmentStatus;

import java.time.LocalDate;
import java.util.Objects;

public class Stduent {
    private String stuId;
    private  String name;
    @Validate(min=0,max = 100)
    private  double ChineseScore;
    @Validate(min=0,max = 100)
    private  double mathScore;
//    学生入学日期
    private LocalDate Enrollmentdates;
    @Validate(regex = "\\w+@\\w+\\.\\w+")
    private String  email;
    /*学生头像*/
    private  String avatar;

    private EnrollmentStatus enrollmentStatus;

    public String getAvatar() {
        return avatar;
    }

    public EnrollmentStatus getEnrollmentStatus() {
        return enrollmentStatus;
    }

    public void setEnrollmentStatus(EnrollmentStatus enrollmentStatus) {
        this.enrollmentStatus = enrollmentStatus;
    }

    public Stduent(String stuId, String name, double chineseScore, double mathScore, LocalDate enrollmentdates, String email, EnrollmentStatus enrollmentStatus) {
        this(stuId, name, chineseScore, mathScore, enrollmentdates,  email);
     this.enrollmentStatus=enrollmentStatus;
    }


    public String getEmail() {
        return email;
    }

    public void setEmail(String email) {
        this.email = email;
    }

    public Stduent(String stuId, String name, double chineseScore, double mathScore, LocalDate enrollmentdates, String email) {
   this(stuId,name,chineseScore,mathScore,enrollmentdates);
        this.email = email;
    }

    public Stduent(String stuId, String name, double chineseScore, double mathScore) {
this(stuId,name,chineseScore,mathScore,LocalDate.now());//入学日期默认为当前日期
    }

    public Stduent(String stuId, String name, double chineseScore, double mathScore, LocalDate enrollmentdates) {
        this.stuId = stuId;
        this.name = name;
        this.ChineseScore = chineseScore;
        this.mathScore = mathScore;
        this.Enrollmentdates = enrollmentdates;
    }

    /*
    求学生的总成绩
    * */
    public double geTotalSocre(){
        return  mathScore+ChineseScore;
    }
    public String getStuId() {
        return stuId;
    }

    public void setStuId(String stuId) {
        this.stuId = stuId;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public double getChineseScore() {
        return ChineseScore;
    }

    public void setChineseScore(double chineseScore) {
        ChineseScore = chineseScore;
    }

    public double getMathScore() {
        return mathScore;
    }

    public void setMathScore(double mathScore) {
        this.mathScore = mathScore;
    }

    public LocalDate getEnrollmentdates() {
        return Enrollmentdates;
    }

    public void setEnrollmentdates(LocalDate enrollmentdates) {
        Enrollmentdates = enrollmentdates;
    }


    @Override
    public String toString() {
        return "Stduent{" +
                "stuId='" + stuId + '\'' +
                ", name='" + name + '\'' +
                ", ChineseScore=" + ChineseScore +
                ", mathScore=" + mathScore +
                ", Enrollmentdates=" + Enrollmentdates +
                ", email='" + email + '\'' +
                ", avatar='" + avatar + '\'' +
                '}';
    }

    public String getAvatar(String s) {
        return avatar;
    }

    public void setAvatar(String avatar) {
        this.avatar = avatar;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;
        Stduent stduent = (Stduent) o;
        return Objects.equals(name, stduent.name);
    }


}
